'use strict'

var winston = require('winston'),
    config = require('./../../config'),
    path = require('path');

var LEVEL = process.env.LEVEL || 'info';

function getLogger(fileName) {
    var logsfile = path.join(config.rootPath, 'logs', fileName);
    var logger = new (winston.Logger)({
        level: LEVEL,
        transports: [
            new (winston.transports.Console)(),               //console.log
            new (winston.transports.File)({filename: logsfile})      //写日志文件
        ]
    });
    return logger;
}

exports.getLogger = getLogger;

console.log(process.cwd())
